<!DOCTYPE html>
<html lang="en" ng-app="MyModule">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<div ng-controller="Ctrl">
		<loader howToLoad="loadData()">滑动加载11111</loader>
	</div>

	<div ng-controller="Ctrl2">
		<loader howToLoad="loadData2()">滑动加载22222</loader>
	</div>

	<script src="angular.js"></script>
	<script type="text/javascript">
		var module = angular.module("MyModule", []);

		module.controller("Ctrl", ["$scope", function($scope) {
			$scope.loadData = function() {
				console.log('加载数据111111....');
			}
		}]);

		module.controller("Ctrl2", ["$scope", function($scope) {
			$scope.loadData2 = function() {
				console.log('加载数据222222....');
			}
		}]);

		module.directive("loader", function() {
			return {
				restrict: "E",
				link: function(scope, element, attr) {
					element.bind("mouseenter", function() {
						// scope.loadData();
						// scope.$apply("loadData()");
						scope.$apply(attr.howtoload);
					})
				}
			}
		})
	</script>
</body>
</html>